package org.locker.service;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import org.locker.device.dto.ManagerClientQueryDto;
import org.locker.domain.Order;
import org.locker.domain.vo.*;
import org.locker.domain.bo.OrderBo;
import org.locker.common.mybatis.core.page.PageQuery;
import com.baomidou.mybatisplus.extension.service.IService;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;
import java.util.Map;

/**
 * 订单Service接口
 *
 * @author winnie
 * @date 2023-10-11
 */
public interface IOrderService extends IService<Order>{

    /**
     * 查询订单
     */
    OrderVo queryById(Long orderId);

    /**
     * 查询订单列表
     */
    Page<OrderVo> queryPageList(OrderBo bo, PageQuery pageQuery);

    /**
     * 查询订单列表
     */
    List<OrderVo> queryList(OrderBo bo);

    /**
     * 新增订单
     */
    Order insertByBo(OrderBo bo);





    /**
     * 取消订单
     * @param orderId
     */
    void cancel(Long orderId);

    /**
     * 结束订单
     *
     * @param orderId
     * @param needOpen
     */
    void close(Order order, boolean needOpen,boolean isAutoClean);


    boolean spiltOrder(String orderNo,boolean isAutoClean);

    Order getByOrderNo(String orderNo);


    /**
     * 订单结算
     */
    void orderSettlement();

    /**
     * 管理端查询订单流水
     * @param queryDto
     * @param pageQuery
     * @return
     */
    Page<OrderFlowVo> queryOrderFlow(ManagerClientQueryDto queryDto, PageQuery pageQuery);

    Page<DeviceFlowVo> queryDeviceFlow(ManagerClientQueryDto queryDto, PageQuery pageQuery);

    Page<PositionFlowVo> queryPositionFlow(ManagerClientQueryDto queryDto, PageQuery pageQuery);

    StatisticsVo statistics(ManagerClientQueryDto queryDto);

    List<Map<String,Integer>> getOrderNumByDeviceId(ManagerClientQueryDto queryDto);

    Page<OrderDetailVo> queryOrderByDay(ManagerClientQueryDto queryDto, PageQuery pageQuery);

    void orderFinished();


    void userOrderOverThreeDay();

    void spiltTaskQuery();

    void orderStatistics();
}
